package org.mikeliu.review.exp6;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String character=scanner.next();
		int sum=0;
		while(scanner.hasNext())
		{
			if(scanner.next().charAt(0)==character.charAt(0))
			{
				sum++;
			}
		}
		System.out.println(sum);
	}
}
